package com.example.demo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.mapper.FamilyMemberMapper;
import com.example.demo.pojo.familymember;
import com.example.demo.service.Fservice;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public abstract class Fserviceimpl extends ServiceImpl<FamilyMemberMapper,familymember> implements Fservice {
    @Override
    public Page<familymember> page(Integer current, Integer size, String name) {
        if(current==null||current<0)
        {
            current=1;
        }
        if(size==null||size<0)
        {
            size=10;
        }
        LambdaQueryWrapper<familymember> queryWrapper = new LambdaQueryWrapper<>();
        if(!"".equals(name))
        {
            queryWrapper.eq(familymember::getName,name);
        }
        page(new Page<>(current,size),queryWrapper);
        return null;
    }
    public boolean saveOrUpdateBymember_id(familymember fm) {
        if (fm.getMember_id()>0)
        {
            return updateById(fm);
        }
        else{
            return save(fm);
        }
    }
    public boolean deleteBatchIds(List<Integer> ids) {
        return removeByIds(ids);
    }
}
